{% extends 'dashboard/base.html' %}

{% block title %}登录 - 巧巧点餐管理后台{% endblock %}

{% block login_content %}
<div class="login-container">
    <div class="login-box">
        <div class="login-logo">
            <h1>巧巧点餐</h1>
            <p>后台管理系统</p>
        </div>
        
        <div class="login-form-container">
            <form method="post" action="{% url 'dashboard:login' %}{% if request.GET.next %}?next={{ request.GET.next|urlencode }}{% endif %}" class="login-form" data-validate="true">
                {% csrf_token %}
                
                {% if error_message %}
                <div class="alert alert-danger">
                    {{ error_message }}
                </div>
                {% endif %}
                
                <div class="form-group">
                    <label for="username">用户名</label>
                    <div class="input-group">
                        <div class="input-group-prepend">
                            <span class="input-group-text"><i class="fas fa-user"></i></span>
                        </div>
                        <input type="text" id="username" name="username" class="form-control" placeholder="请输入用户名" required>
                    </div>
                </div>
                
                <div class="form-group">
                    <label for="password">密码</label>
                    <div class="input-group">
                        <div class="input-group-prepend">
                            <span class="input-group-text"><i class="fas fa-lock"></i></span>
                        </div>
                        <input type="password" id="password" name="password" class="form-control" placeholder="请输入密码" required>
                    </div>
                </div>
                
                <div class="form-group form-check">
                    <input type="checkbox" id="remember_me" name="remember_me" class="form-check-input">
                    <label for="remember_me" class="form-check-label">记住我</label>
                </div>
                
                <div class="form-group">
                    <button type="submit" class="btn btn-primary btn-block">
                        <i class="fas fa-sign-in-alt"></i> 登录
                    </button>
                </div>
                
                <!-- 如果有next参数，传递给后端 -->
                {% if request.GET.next %}
                <input type="hidden" name="next" value="{{ request.GET.next }}">
                {% endif %}
            </form>
        </div>
    </div>
</div>
{% endblock %} 